Skip to content

Recover market demand every four hours - #23

Merged
Drefvelin merged 2 commits into
mainfrom
demand-recovery-interval
Sep 26, 2026
Merged

Drefvelin merged 2 commits into
mainfrom
demand-recovery-interval

Conversation

@Drefvelin

@Drefvelin Drefvelin commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Make the demand recovery interval a demand-recovery-hours config value, defaulting to 4 hours (288,000 ticks) instead of the hardcoded 1 hour.
  • /marketblock reload reschedules the recovery task at the configured interval without granting an extra tick. Plugin startup still runs the first tick immediately, as before.
  • Add JUnit tests for the schedule, config loading, and demand recovery bounds.

Test plan

  • mvn -P'!deploy-live' test passes locally (10 tests)
  • Development build on this pull request succeeds
  • After release, copy marketblock-0.1.3.jar and add demand-recovery-hours: 4 to the live config as a routine change

Made with Cursor

Summary by CodeRabbit

  • New Features
    • Demand recovery now runs on a configurable schedule, set to four hours by default instead of a fixed one-hour interval.
    • Recovery begins when the trade manager starts and applies to loaded trades, with the market view refreshed afterward.
    • Invalid or non-positive recovery intervals fall back to the four-hour default. You can adjust the interval in the configuration file.

Make the demand recovery interval configurable so the live market can wait four hours between ticks instead of one, and cover the schedule with unit tests.

Co-authored-by: Cursor <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: c8be63a1-9481-4835-99f2-a2bdf22ed25d

📥 Commits

Reviewing files that changed from the base of the PR and between d09e37f and 9658aa0.

📒 Files selected for processing (10)
  • pom.xml
  • src/main/java/net/tfminecraft/marketblock/Cache.java
  • src/main/java/net/tfminecraft/marketblock/MarketBlock.java
  • src/main/java/net/tfminecraft/marketblock/loader/ConfigLoader.java
  • src/main/java/net/tfminecraft/marketblock/manager/TradeManager.java
  • src/main/java/net/tfminecraft/marketblock/util/DemandSchedule.java
  • src/main/resources/config.yml
  • src/test/java/net/tfminecraft/marketblock/loader/ConfigLoaderTest.java
  • src/test/java/net/tfminecraft/marketblock/trade/TradeDemandTest.java
  • src/test/java/net/tfminecraft/marketblock/util/DemandScheduleTest.java
 ____________________
< I dream in semver. >
 --------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

@Drefvelin
Drefvelin merged commit e31504f into main Sep 26, 2026
1 of 2 checks passed
@Drefvelin
Drefvelin deleted the demand-recovery-interval branch September 26, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant